<template>
  <page-header-wrapper>
    <template slot="extra" >
      <back-button />
    </template>
    <a-spin :spinning="loading">
      <a-card :bordered="false">
        <a-descriptions title="订单信息">
          <a-descriptions-item label="订单编号" :span="3">{{ order.out_trade_no }}</a-descriptions-item>
          <a-descriptions-item label="是否使用优惠券" :span="3">{{ order.card_discount === 2 ? '是' : '否' }}</a-descriptions-item>
          <a-descriptions-item label="使用会员身份" :span="3">{{ order.is_vip_discount === 1 ? '是' : '否' }}</a-descriptions-item>
          <a-descriptions-item label="派遣工作者" :span="3">{{ order.worker }}</a-descriptions-item>
          <a-descriptions-item label="服务联系人">{{ `${order.serve_name || ''} ${order.serve_mobile || ''}` }}</a-descriptions-item>
          <a-descriptions-item label="服务地址" :span="2">{{ order.serve_address }}</a-descriptions-item>
          <a-descriptions-item label="价格" >{{ '￥' + order.price }}</a-descriptions-item>
          <a-descriptions-item label="支付方式" :span="2">{{ order.pay_type | payTypeFilter }}</a-descriptions-item>
          <a-descriptions-item label="订单创建时间" :span="3">{{ order.ctime }}</a-descriptions-item>
        </a-descriptions>
        <a-divider />
        <div class="table-title">服务列表</div>
        <a-table
          row-key="id"
          :columns="columns"
          :dataSource="cart"
          :pagination="false"
        >
        </a-table>
      </a-card>
    </a-spin>
  </page-header-wrapper>
</template>

<script>
import { houseOrderDetail } from '@/api/house'
import payStatus from '@/mixins/payStatus'
import orderStatus from '@/mixins/orderStatus'
import BackButton from '@/components/BackButton'

const columns = [
  {
    title: '家政名称',
    dataIndex: 'name'
  },
  {
    title: '类型',
    dataIndex: 'kinds_name'
  }
]

export default {
  components: {
    BackButton
  },
  mixins: [orderStatus, payStatus],
  data () {
    return {
      cart: [],
      order: {},
      store: {},
      columns,
      loading: false,
      manager_type: 1
    }
  },
  created () {
      this.applianceOrderDetail()
  },
  methods: {
      applianceOrderDetail () {
          const params = this.$route.query
          this.loading = true
          return houseOrderDetail(params).then(res => {
                this.cart = [res.data.info]
                this.order = res.data.order
                this.manager_type = res.data.manager_type
                this.printList = res.data.car
                const data = {
                  data: res.data.car
                }
                this.loading = false
                return data
          })
      }
  }

}
</script>
